﻿using System;
namespace Producers.Liiklusregister.Xtee.Riik.Ee.Producer.Liiklusregister {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="soidukiandmed1tulem", Namespace="http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister", Target=typeof(Soidukiandmed1tulem))]
    public class Soidukiandmed1tulemSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected ISoidukiandmed1tulem clazz;
        
        public Soidukiandmed1tulemSerializer(ISoidukiandmed1tulem clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("id");
            if (clazz.Id!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "integer");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdInteger(((decimal)(clazz.Id))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("mark");
            if (clazz.Mark!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Mark))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("mudel");
            if (clazz.Mudel!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Mudel))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("reg_mrk");
            if (clazz.RegMrk!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.RegMrk))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("registris");
            if (clazz.Registris!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "date");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDate(((System.DateTime)(clazz.Registris))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("vinkood");
            if (clazz.Vinkood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Vinkood))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
        START:
            if ((Reader.LocalName == "id")) {
                goto id;
            }
            else {
                if ((Reader.LocalName == "mark")) {
                    goto mark;
                }
                else {
                    if ((Reader.LocalName == "mudel")) {
                        goto mudel;
                    }
                    else {
                        if ((Reader.LocalName == "reg_mrk")) {
                            goto reg_mrk;
                        }
                        else {
                            if ((Reader.LocalName == "registris")) {
                                goto registris;
                            }
                            else {
                                if ((Reader.LocalName == "vinkood")) {
                                    goto vinkood;
                                }
                                else {
                                    return;
                                }
                            }
                        }
                    }
                }
            }
        id:
            if ((Reader.IsElementNil() == false)) {
                clazz.Id = new global::Xtee.Core.Schema.XsdInteger(Reader.ReadElementString("id")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        mark:
            if ((Reader.IsElementNil() == false)) {
                clazz.Mark = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("mark")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        mudel:
            if ((Reader.IsElementNil() == false)) {
                clazz.Mudel = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("mudel")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        reg_mrk:
            if ((Reader.IsElementNil() == false)) {
                clazz.RegMrk = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("reg_mrk")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        registris:
            if ((Reader.IsElementNil() == false)) {
                clazz.Registris = new global::Xtee.Core.Schema.XsdDate(Reader.ReadElementString("registris")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        vinkood:
            if ((Reader.IsElementNil() == false)) {
                clazz.Vinkood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("vinkood")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        }
    }
}
